<?php 

	/**
	 * 克隆对象方法 __clone()
	 */
	

	class Person {
		public $name = "";
		public $age  = 18;
		public $sex  = "男";

		public function __construct($name, $age, $sex) {
			$this->name = $name;
			$this->age  = $age;
			$this->sex  = $sex;
		}

		public function say() {
			echo "我叫".$this->name;
		}

		public function __toString() {
			echo "Hello!!!";
		}

		public function __clone() {
			$this->name = "克隆的张三";
			$this->age  = 0;
		}
	}

	$p1 = new Person("张三", 20, "男");
	echo $p1->say();
	echo "<br>";

	$p1_copy = clone $p1;
	echo $p1_copy->say();









 ?>